package com.ww.seckill.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Administrator
 * @desc ww
 */
@Configuration
public class RabbitMqConfig {

    /**
     * 队列
     */
//    private static final String QUEUE = "queue";
    private static final String SEC_KILL_QUEUE = "secKillQueue";
    private static final String SEC_KILL_EXCHANGE = "secKillExchange";

/*    *//**
     * 准备队列
     *
     * @return 队列
     *//*
    @Bean
    public Queue queue() {
        return new Queue(QUEUE);
    }*/

    @Bean
    public Queue queue() {
        return new Queue(SEC_KILL_QUEUE);
    }

    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange(SEC_KILL_EXCHANGE);
    }

    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(topicExchange()).with("seckill.#");
    }



}